import { useDispatch, useSelector } from 'react-redux'
import { useEffect } from 'react'
import { getChannel } from '@/store/actions/channel'
// 自定义的hook
export default function useChannel () {
  const dispatch = useDispatch()

  // 获取频道数据
  const channels = useSelector((state) => state.channel)

  useEffect(() => {
    dispatch(getChannel())
  }, [])

  return channels
}
